//
//  DetailNextViewController.swift
//  MyNavigationbar
//
//  Created by teleframe on 15/8/20.
//  Copyright (c) 2015年 tf. All rights reserved.
//

import UIKit

class DetailNextViewController: UIViewController,UIPopoverPresentationControllerDelegate {

    
    @IBOutlet var tag: UILabel!
    
    
    override func viewDidLoad() {
//       self.navigationItem.title = "DetailNext"
    }
    
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        if segue.identifier == "popoverSegue" {
            let popoverViewController = segue.destinationViewController as! PopoverViewController
            popoverViewController.selectionHandler = self.selectionHandler
            popoverViewController.modalPresentationStyle = UIModalPresentationStyle.Popover
            popoverViewController.popoverPresentationController!.delegate = self
        }
    }
    
    func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle {
        return UIModalPresentationStyle.None
    }
    
    func selectionHandler(item:Int){
      
        tag.text = "tag=\(item)"
    }
}
